package com.zelix;

import java.lang.reflect.Array;
import java.util.*;

public class vy
        implements Collection {

    HashMap a;

    public vy(int i) {
        a = new HashMap(px.a(i));
    }

    public synchronized boolean add(Object obj) {
        sx sx1 = (sx) a.get(obj);
        if (sx1 == null) {
            sx1 = new sx(1);
            a.put(obj, sx1);
        } else {
            sx1.c();
        }
        return true;
    }

    public synchronized boolean addAll(Collection collection) {
        Iterator iterator1;
//        int i;
//        i = hs.c;
        iterator1 = collection.iterator();
        while (iterator1.hasNext()) {
            add(iterator1.next());
        }
        return true;
    }

    public void clear() {
        a.clear();
    }

    public synchronized Object clone() {
        vy vy1;
        Iterator iterator1;
        vy1 = new vy(a.size());
        iterator1 = a.entrySet().iterator();
        while (iterator1.hasNext()) {
            Map.Entry entry = (Map.Entry) iterator1.next();
            sx sx1 = (sx) entry.getValue();
            vy1.a(entry.getKey(), sx1.b());
        }
        return vy1;

    }

    public boolean contains(Object obj) {
        return a.containsKey(obj);
    }

    public boolean containsAll(Collection collection) {
        Iterator iterator1;
//        int i;
//        i = hs.c;
        iterator1 = collection.iterator();

        while (iterator1.hasNext()) {
            if (!a.containsKey(iterator1.next()))
                return false;
        }
        return true;
    }

    public int a(Object obj) {
        sx sx1 = (sx) a.get(obj);
        if (sx1 == null)
            return 0;
        else
            return sx1.b();
    }

    public synchronized List a(boolean flag) {
        int i;
        rx arx[];
        int j;
        Iterator iterator1;
        i = a.size();
        arx = new rx[i];
        j = 0;
        iterator1 = a.keySet().iterator();

        while (iterator1.hasNext()) {
            Object obj = iterator1.next();
            sx sx1 = (sx) a.get(obj);
            arx[j++] = new rx(sx1.b(), obj);
        }
        ArrayList arraylist;
        Arrays.sort(arx);
        arraylist = new ArrayList(i);

        if (flag) {
            for (int k = 0; k < i; k++) {
                arraylist.add(arx[k].b());
            }
        } else {
            for (int k = i - 1; k >= 0; k--) {
                arraylist.add(arx[k].b());
            }
        }
        return arraylist;
    }

    public boolean isEmpty() {
        return a.size() == 0;
    }

    public synchronized Iterator iterator() {
        return new wy(this, a.keySet());
    }

    public synchronized boolean remove(Object obj) {
        label0:
        {
            sx sx1 = (sx) a.get(obj);
            if (sx1 == null)
                break label0;
            if (sx1.b() == 1) {
                a.remove(obj);
            } else {
                sx1.a();
            }
            return true;
        }
        return false;
    }

    public synchronized boolean removeAll(Collection collection) {
        int i;
        Iterator iterator1;
        i = a.size();
        iterator1 = collection.iterator();
        while (iterator1.hasNext()) {
            a.remove(iterator1.next());
        }
        return i != a.size();
    }

    public synchronized boolean retainAll(Collection collection) {
        int i;
        Iterator iterator1;
        i = a.size();
        iterator1 = a.keySet().iterator();
        while (iterator1.hasNext()) {
            Object obj = iterator1.next();
            if (!collection.contains(obj))
                iterator1.remove();
        }
        return i != a.size();
    }

    public synchronized void a(Object obj, int i) {
        sx sx1 = (sx) a.get(obj);
        if (sx1 == null) {
            a.put(obj, new sx(i));
        } else {
            sx1.a(i);
        }
    }

    public int size() {
        return a.size();
    }

    public Object[] toArray() {
        Object aobj[];
        int i;
        Iterator iterator1;
        aobj = new Object[a.size()];
        i = 0;
        iterator1 = a.keySet().iterator();

        while (iterator1.hasNext()) {
            aobj[i++] = iterator1.next();
        }
        return aobj;
    }

    public Object[] toArray(Object aobj[]) {
        int i;
        Iterator iterator1;
        if (aobj.length < a.size())
            aobj = (Object[]) Array.newInstance(((Object) (aobj)).getClass().getComponentType(), a.size());
        i = 0;
        iterator1 = a.keySet().iterator();

        while (iterator1.hasNext()) {
            aobj[i++] = iterator1.next();
        }
        if (aobj.length > a.size())
            aobj[a.size()] = null;
        return aobj;
    }
}